﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using Synology.AudioStationApi;

namespace MEF_Test.Module.AudioStation.Tests
{
    /// <summary>
    /// Summary description for SynoEntitiesCreationTests
    /// </summary>
    [TestClass]
    public class SynoEntitiesCreationTests
    {
        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext { get; set; }

        #region Additional test attributes
        //
        // You can use the following additional attributes as you write your tests:
        //
        // Use ClassInitialize to run code before running the first test in the class
        // [ClassInitialize()]
        // public static void MyClassInitialize(TestContext testContext) { }
        //
        // Use ClassCleanup to run code after all tests in a class have run
        // [ClassCleanup()]
        // public static void MyClassCleanup() { }
        //
        // Use TestInitialize to run code before running each test 
        // [TestInitialize()]
        // public void MyTestInitialize() { }
        //
        // Use TestCleanup to run code after each test has run
        // [TestCleanup()]
        // public void MyTestCleanup() { }
        //
        #endregion

        [TestMethod]
        public void CreationAlbumTest()
        {
            SynoItem album = new SynoItem
                              {
                                  AlbumArtUrl = "albumarturl",
                                  Icon = "Icon",
                                  IsContainer = true,
                                  IsTrack = false,
                                  ItemID = "itemId",
                                  ItemPid = "itempid",
                                  Sequence = 12,
                                  Support = false,
                                  Title = "title"
                              };
            AudioStationFileHandler albumFileHandler = new AudioStationFileHandler(AudioStationAction.Browse, album);
            Assert.AreEqual(album.AlbumArtUrl, albumFileHandler.AlbumArtUrl);
            Assert.AreEqual(album.Icon, albumFileHandler.Icon);
            Assert.AreEqual(album.IsContainer, albumFileHandler.CanHaveChildren);
            Assert.AreEqual(album.IsTrack, albumFileHandler.IsTrack);
            Assert.AreEqual(album.ItemID, albumFileHandler.ItemID);
            Assert.AreEqual(album.ItemPid, albumFileHandler.ItemPid);
            Assert.AreEqual(album.Sequence, albumFileHandler.Sequence);
            Assert.AreEqual(album.Support, albumFileHandler.Support);
            Assert.AreEqual(album.Title, albumFileHandler.Title);
        }

        // create an album or an artist is exactly the same thing, but now, we have a triangulation.
        [TestMethod]       
        public void CreationArtistTest()
        {
            SynoItem artist = new SynoItem
                                {
                                    AlbumArtUrl = "albumarturl2",
                                    Icon = "Icon2",
                                    IsContainer = true,
                                    IsTrack = false,
                                    ItemID = "itemId2",
                                    ItemPid = "itempid2",
                                    Sequence = 2,
                                    Support = false,
                                    Title = "ArtistName",
                                };



            AudioStationFileHandler artistFileHandler = new AudioStationFileHandler(AudioStationAction.Browse, artist);
            Assert.AreEqual(artist.AlbumArtUrl, artistFileHandler.AlbumArtUrl);
            Assert.AreEqual(artist.Icon, artistFileHandler.Icon);
            Assert.AreEqual(artist.IsContainer, artistFileHandler.CanHaveChildren);
            Assert.AreEqual(artist.IsTrack, artistFileHandler.IsTrack);
            Assert.AreEqual(artist.ItemID, artistFileHandler.ItemID);
            Assert.AreEqual(artist.ItemPid, artistFileHandler.ItemPid);
            Assert.AreEqual(artist.Sequence, artistFileHandler.Sequence);
            Assert.AreEqual(artist.Support, artistFileHandler.Support);
            Assert.AreEqual(artist.Title, artistFileHandler.Title);

        }
   

    }
}
